M68KDIS

Section: User Commands (1)
Updated: November 15, 1994
Index Return to Main Contents
 

NAME

m68kdis - disassemble Motorola 68000 family object code  

SYNOPSIS

m68kdis [-ddd] [-a file] [-all[c]] [-b file] [-bad] [-f file] [-fdigits digits] [-i file] [-isp] [-j file] [-l] [-lft] [-n file] [-ns file] [-o file] [-odd] [-pc initialpc] [-s length] [-slenp length] [-sp] file...  

DESCRIPTION

m68kdis is a disassembler for the Motorola 68000 family of cpu chips. The disassembler attempts to discern between the instruction and data portions of an object code file.

m68kdis produces output files much like cc(1). When the -o option is not used, file arguments that end in .o have output filenames with .s substituted for .o; otherwise, .s is simply appended.

The output consists of five columns:

*
program counter in hexadecimal
*
file contents with each byte displayed as two characters in hexadecimal
*
label (if any)
*
instruction name
*
operands (if any)
 

OPTIONS

-ddd
Specifies the chip and coprocessors. Valid values for ddd are currently 000, 008, 010, 020, 030, 851, 881, and 882. This option may be repeated as appropriate. The default is 000 with no coprocessors.
-a file
Specifies that file contains lines of the form ``aXXX instruction-string'' which specify acceptable A-line opcodes. XXX is in hexadecimal.
-all[c]
Specifies that only one pass should be made, outputting the instruction (if any) at each word boundary. If the c is included, -i, -j, -n and -ns options are also processed, and another pass is made to ensure consistency between instructions.
-b file
Specifies that file contains program counter values which are taken as locations in data to be output on a new line. The values should be one to a line, and of a form acceptable to strtoul() with base equal to 0.
-bad
Specifies that lines should be printed to standard error that specify which data caused a potential instruction to be made invalid.
-f file
Specifies that file contains lines of the form ``fXXX instruction-string'' which specify acceptable F-line opcodes. XXX is in hexadecimal.
-fdigits digits
Specifies that mantissas of floating-point constants should be printed with digits significant digits. The minimum value of digits is 2; the default is 6.
-i file
Specifies that file contains program counter values which are, if possible, to be taken as locations of valid instructions. The values should be one to a line, and of a form acceptable to strtoul() with base equal to 0.
-isp
Specifies that the determination of a printing character should be done by the local system's isprint(). By default, only ASCII characters (0x20 to 0x7e inclusive) are considered printing characters.
-j file
Specifies that file contains A-line and F-line opcodes which are unconditional jumps and therefore do not need to be followed by a valid instruction. The values should be one to a line, and of a form acceptable to strtoul() with base equal to 0.
-l
Specifies that output should be in lower-case. (Exception: Label references retain an upper-case ``L''.)
-lft
Specifies that instructions that ``fall through'' to a LINK instruction should be considered valid. By default, these instructions are considered invalid.
-n file
Specifies that file contains program counter values which are to be taken as locations of data. The values should be one to a line, and of a form acceptable to strtoul() with base equal to 0.
-ns file
Specifies that file contains program counter values which are to be taken as locations at which instructions do not begin. The words at these locations may, however, be extension words of instructions. The values should be one to a line, and of a form acceptable to strtoul() with base equal to 0.
-o file
Specifies the output file. Only one file to be disassembled may be given when this option is used.
-odd
Specifies that instructions may begin at odd offsets. This can be useful when code to be disassembled is not stripped out of an object file. In particular, this option is often needed when disassembling an intact Macintosh resource fork.
-pc initialpc
Specifies that initialpc be taken as the program counter value for the start of the object code. The default is 0.
-s length
Specifies that data contain at least length consecutive printing characters to be output as a string. The minimum value for length is 2; the default is 5.
-slenp length
Specifies that strings should print out no more than length characters per output line. The minimum value for length is 10; the default is 30.
-sp
Specifies that register A7 should be output as SP, except in MOVEM instructions.
 

NOTES

The output is based on Motorola syntax.

Immediate values are sometimes also output in hexadecimal after an intervening !.

The following procedure is used to filter out the data from the instructions:

*
An initial pass is made determining at which file offsets potential instructions exist and the sizes of those instructions including operands.
*
File offsets specified by the user as being data are processed.
*
File offsets specified by the user as not starting instructions are processed.
*
File offsets specified by the user as being instructions are processed.
*
Potential instructions which reference data as instructions are changed to data. (This step is repeated after each of the remaining steps.)
*
LINK instructions which are referenced by BSR and JSR instructions are accepted as final instructions. (A final instruction is one that is included in the final output.)
*
Remaining LINK instructions are accepted as final instructions.
*
Branching and jumping instructions that reference final instructions and are not potential extension words of floating-point instructions are accepted as final instructions.
*
Remaining branching and jumping that are not extension words of potential floating-point instructions and returning instructions are accepted as final instructions.
*
Overlapping instructions are selected by minimizing the amount of data.
 

BUGS

Since m68kdis uses the imperfect procedure given in the NOTES, errors may result in the instruction/data determination. When problems are suspected, the -badX option can be used to determine why instructions get interpreted as data. You can then use the -i, -ns, and -n options, as appropriate.

The character set used in the object file may be neither ASCII nor that used by the local system.

Two unusual conditions checked for should be mentioned. Sometimes the decision to designate an instruction as a final instruction is later contradicted and the instruction is changed to data. In general, the instruction causing the contradiction should be regarded as data via the -ns option. Also, sometimes it is reported that there is an ``overlap'' at a certain offset. This is because m68kdis is unsure if the best selection of two possible instructions which overlap each other was made. A quick inspection of the output at this offset should clear this up. Messages for these conditions are printed to standard error.  

SEE ALSO

1.
Motorola: M68000 8/16/32 Bit Microprocessors: Programmer's Reference Manual, 5th ed., Prentice-Hall, Englewood Cliffs, NJ, 1986.
2.
Motorola: M68030: Enhanced 32-Bit Microprocessor User's Manual, 2nd ed., Prentice-Hall, Englewood Cliffs, NJ, 1989.
3.
Motorola: M68851: Paged Memory Management Unit User's Manual, 2nd ed., Prentice-Hall, Englewood Cliffs, NJ, 1989.
4.
Motorola: M68881/MC68882: Floating-Point Coprocessor User's Manual, 2nd ed., Prentice-Hall, Englewood Cliffs, NJ, 1989.
 

AUTHOR

Christopher G. Phillips
Christopher_Phillips@pe.utexas.edu


 

Index

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
NOTES
BUGS
SEE ALSO
AUTHOR

This document was created by man2html, using the manual pages.
Time: 01:01:09 GMT, August 31, 2024